package com.joysuch.wwyt.api.config.service;

import cn.zlg.common.util.CollectionUtils;
import com.joysuch.wwyt.api.config.entity.DataAccessConfig;
import com.joysuch.wwyt.api.config.repository.DataAccessConfigDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author ZhangDong
 * @Date 2020/8/17 11:38
 */
@Service
@Slf4j
public class DataAccessConfigServiceImpl implements DataAccessConfigService {

    @Autowired
    private DataAccessConfigDao dao;

    @Override
    public DataAccessConfig getByOrgCode() {
        List<DataAccessConfig> list = dao.findAll();
        if (CollectionUtils.isEmpty(list)) {
            return null;
        }
        return list.get(0);
    }

}
